Private Sub ExtractCaptions(recFormal As Recordset, strFormality As String, strFormName As String)
   Dim frmF As Form
   Dim ctlC As Control
   Dim strControlName As String
   Dim datNow As Date
   Dim intControlType As Integer
   
   'Open the form, hidden, in Design View
   DoCmd.OpenForm strFormName, acDesign, , , , acHidden
   datNow = Now()
   
   'Add the form caption
   Set frmF = Forms(strFormName)
   With recFormal
      .Seek "=", strFormName, strFormName

      'Add a record to or update a record in the Formality Changer table
      If .NoMatch Then
         .AddNew
      Else
         .Edit
      End If

      'Specify field contents
      !FormName = strFormName
      !ControlName = strFormName
      !ControlType = "Form"
      !DateUpdated = datNow
      .Fields(strFontStyle) = frmF.Caption
      .Update
      
      'Loop through the controls
      For Each ctlC In frmF.Controls
      
         intControlType = ctlC.ControlType
         If intControlType = acCommandButton Then
            'Find the control in the tblFormality table
            strControlName = ctlC.Name
            .Seek "=", strFormName, strControlName
            
            'Add a record for or update the existing record 
            'for the control in the Formality Changer table
            If .NoMatch Then
               .AddNew
            Else
               .Edit
            End If
            
            'Specify field contents
            !FormName = strFormName
            !ControlName = strControlName
            !ControlType = "Command button"
            !DateUpdated = datNow
            .Fields(strFontStyle) = ctlC.Caption
            .Update
         End If
      Next
   End With
   
   'Close and save the form
   DoCmd.Close acForm, strFormName, acSaveYes
   
End Sub
